1 using System.Collections;
2 using
System.Collections.Generic;
3 using
UnityEngine;
4 using
UnityEngine.UI;
5
6 public
class WinManager : MonoBehaviour {
7
8     
public Text whiteScoreText;
9     
public Text blackScoreText;
10     
public Text winnerText;
11     
public Text maxGamesText;
12
13     
void Awake() {
14         LoadScores();
15     }
16
17     
// Use this for initialization
18     
void Start () {
19         
20     }
21     
22     
// Update is called once per frame
23     
void Update () {
24         
25     }
26
27     
public void LoadScores() {
28         
int white = PlayerPrefs.GetInt(GameManager.PLAYER_WHITE,0);
29         
int black = PlayerPrefs.GetInt(GameManager.PLAYER_BLACK,0);
30         whiteScoreText.text =
"White: " + white.ToString();
31         blackScoreText.text =
"Black: " + black.ToString();
32
33         
if (white > black) {
34             winnerText.text =
"WHITE";
35         }
else if (white < black) {
36             winnerText.text =
"BLACK";
37         }
else {
38             winnerText.text =
"NO ONE";
39         }
40         
int maxGames = PlayerPrefs.GetInt(GameManager.GAME_MAX,0);
41         maxGamesText.text =
"OUT OF " + maxGames + " GAMES";
42         GameManager.ResetScores();
43     }
44 }


Use this for initialization

Update is called once per frame



Gõ tìm kiếm nhanh...